import Vue from 'vue'
import App from './App.vue'

import store from'./store'
import router from './router'
import vueQr from 'vue-qr'

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import 'font-awesome/css/font-awesome.css';
import {postRequest} from "./utils/api";
import {putRequest} from "./utils/api";
import {getRequest} from "./utils/api";
import {deleteRequest} from "./utils/api";

Vue.config.productionTip = false

Vue.use(ElementUI);
Vue.use(vueQr);

//插件
Vue.prototype.postRequest = postRequest;
Vue.prototype.putRequest = putRequest;
Vue.prototype.getRequest = getRequest;
Vue.prototype.deleteRequest = deleteRequest;


// router.beforeEach((to, from, next)=>{
//   //获取token
//   if (window.sessionStorage.getItem('tokenStr')){
//     //判断用户信息是否存在
//     if (!window.sessionStorage.getItem('user')){
//       return getRequest('/manager/info').then(res=>{
//         if (res){
//           //存入用户信息  sessionStorage只能存入字符串   需要转换成字符串
//           window.sessionStorage.setItem('user',res);
//           next();
//         }
//       })
//     }
//     next();
//   }else{
//     if (to.path === '/Login') {
//       next();
//     } else {
//       next('/?redirect=' + to.path);
//     }
//
//   }
// })

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App),
}).$mount('#app')
